
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>位运算应用实例 · tgor note</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="tgor">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../Mongodb-Client/morphia-API汇总.html" />
    
    
    <link rel="prev" href="../Java-Spring/SpringBoot事务注解@Transactional.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Me
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../category/微服务.html">
            
                <a href="../category/微服务.html">
            
                    
                    微服务
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../Java-Spring/Feign.html">
            
                <a href="../Java-Spring/Feign.html">
            
                    
                    HTTP客户端Feign
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../Java-其他库/限流.html">
            
                <a href="../Java-其他库/限流.html">
            
                    
                    限流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../运维/Nginx限流.html">
            
                <a href="../运维/Nginx限流.html">
            
                    
                    限流Nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../Java-Spring/负载均衡.html">
            
                <a href="../Java-Spring/负载均衡.html">
            
                    
                    负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../运维/Nginx负载均衡.html">
            
                <a href="../运维/Nginx负载均衡.html">
            
                    
                    负载均衡Nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../Java-其他库/熔断Hystrix.html">
            
                <a href="../Java-其他库/熔断Hystrix.html">
            
                    
                    熔断Hystrix
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../Java-其他库/缓存.html">
            
                <a href="../Java-其他库/缓存.html">
            
                    
                    缓存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../Java-其他库/缓存.html">
            
                <a href="../Java-其他库/缓存.html#本地缓存">
            
                    
                    本地缓存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html">
            
                    
                    分布式缓存Redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="../Java-其他库/分布式事务.html">
            
                <a href="../Java-其他库/分布式事务.html">
            
                    
                    分布式事务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.11" data-path="../Java-其他库/分布式事务.html">
            
                <a href="../Java-其他库/分布式事务.html#事务消息">
            
                    
                    可靠事务消息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.12" data-path="../Java-Spring/业务监控.html">
            
                <a href="../Java-Spring/业务监控.html">
            
                    
                    业务监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.13" data-path="../Java-其他库/分布式定时作业.html">
            
                <a href="../Java-其他库/分布式定时作业.html">
            
                    
                    分布式作业调度ElasticJob
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.14" data-path="../Java-ORM/ORM.html">
            
                <a href="../Java-ORM/ORM.html">
            
                    
                    ORM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.15" data-path="../Java-其他库/分布式系统及CAP原理.html">
            
                <a href="../Java-其他库/分布式系统及CAP原理.html">
            
                    
                    分布式系统及CAP原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.16" data-path="../MQ/RabbitMQ笔记.html">
            
                <a href="../MQ/RabbitMQ笔记.html">
            
                    
                    消息驱动Rabbitmq
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../category/数据库.html">
            
                <a href="../category/数据库.html">
            
                    
                    数据库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../Mysql/经典数据库设计案例.html">
            
                <a href="../Mysql/经典数据库设计案例.html">
            
                    
                    mysql设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../Mysql/Mysql事务与锁.html">
            
                <a href="../Mysql/Mysql事务与锁.html">
            
                    
                    mysql事务与锁
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../Mysql/mysql数据类型.html">
            
                <a href="../Mysql/mysql数据类型.html">
            
                    
                    mysql数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../Mysql/mysql索引及查询.html">
            
                <a href="../Mysql/mysql索引及查询.html">
            
                    
                    mysql索引与查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../Mysql/mysql索引及查询.html">
            
                <a href="../Mysql/mysql索引及查询.html#查询语句设计准则">
            
                    
                    mysql查询语句设计准则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../Mysql/mysql性能测试.html">
            
                <a href="../Mysql/mysql性能测试.html">
            
                    
                    mysql性能测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../Mysql/mysql主从同步与读写分离.html">
            
                <a href="../Mysql/mysql主从同步与读写分离.html">
            
                    
                    mysql主从同步与读写分离
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../Java-Spring/SpringBoot事务注解@Transactional.html">
            
                <a href="../Java-Spring/SpringBoot事务注解@Transactional.html">
            
                    
                    Spring事务注解@Transactional
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.9" data-path="位运算应用实例.html">
            
                <a href="位运算应用实例.html">
            
                    
                    位运算应用实例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="../Mongodb-Client/morphia-API汇总.html">
            
                <a href="../Mongodb-Client/morphia-API汇总.html">
            
                    
                    morphia API汇总
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.11" data-path="../Mongodb-Client/mongo驱动连接.html">
            
                <a href="../Mongodb-Client/mongo驱动连接.html">
            
                    
                    mongodb驱动与连接
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="../Mongodb/mongodb-ObjectId实践.html">
            
                <a href="../Mongodb/mongodb-ObjectId实践.html">
            
                    
                    mongodb ObjectId实践
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.13" data-path="../Mongodb/mongodb角色权限.html">
            
                <a href="../Mongodb/mongodb角色权限.html">
            
                    
                    mongodb角色权限
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../category/java并发.html">
            
                <a href="../category/java并发.html">
            
                    
                    Java并发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../Java-Base/Java并发.html">
            
                <a href="../Java-Base/Java并发.html">
            
                    
                    Java并发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../Java-Base/Java并发.html">
            
                <a href="../Java-Base/Java并发.html#锁">
            
                    
                    Java并发之锁设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../Java-Base/Java并发.html">
            
                <a href="../Java-Base/Java并发.html#synchronized">
            
                    
                    Java并发之synchronized
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../Java-Base/Java之Lock.html">
            
                <a href="../Java-Base/Java之Lock.html#reentrantlock">
            
                    
                    Java Lock之ReentrantLock
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../Java-Base/Java之Lock.html">
            
                <a href="../Java-Base/Java之Lock.html#reentrantreadwritelock">
            
                    
                    Java Lock之ReentrantReadWriteLock
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html">
            
                    
                    Java Future
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html#futuretask">
            
                    
                    Java Future之FutureTask
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html#completablefuture">
            
                    
                    Java Future之CompletableFuture
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../Java-Base/Java之Future.html">
            
                <a href="../Java-Base/Java之Future.html#forkjointask">
            
                    
                    Java Future之ForkJoinTask
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../Java-Base/Java之Thread.html">
            
                <a href="../Java-Base/Java之Thread.html">
            
                    
                    Java Thread
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../category/redis.html">
            
                <a href="../category/redis.html">
            
                    
                    Redis
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html">
            
                    
                    Redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#集群">
            
                    
                    Redis集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#消息订阅">
            
                    
                    Redis消息订阅
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#lua">
            
                    
                    Redis Lua脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../Redis/Redis.html">
            
                <a href="../Redis/Redis.html#配置汇总">
            
                    
                    Redis配置汇总
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../category/运维.html">
            
                <a href="../category/运维.html">
            
                    
                    运维
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../运维/Linux常用操作汇总.html">
            
                <a href="../运维/Linux常用操作汇总.html">
            
                    
                    Linux常用操作汇总
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../运维/阿里云笔记.html">
            
                <a href="../运维/阿里云笔记.html">
            
                    
                    阿里云笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../category/nginx.html">
            
                <a href="../category/nginx.html">
            
                    
                    Nginx
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../运维/Nginx学习笔记.html">
            
                <a href="../运维/Nginx学习笔记.html">
            
                    
                    Nginx基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../运维/Nginx负载均衡.html">
            
                <a href="../运维/Nginx负载均衡.html">
            
                    
                    Nginx负载均衡
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../运维/Nginx限流.html">
            
                <a href="../运维/Nginx限流.html">
            
                    
                    Nginx限流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../运维/Nginx学习笔记.html">
            
                <a href="../运维/Nginx学习笔记.html#六、其他">
            
                    
                    Nginx客户端辅助技巧
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../category/容器化.html">
            
                <a href="../category/容器化.html">
            
                    
                    容器化
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../Docker/docker笔记.html">
            
                <a href="../Docker/docker笔记.html">
            
                    
                    Docker学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../Docker/docker笔记.html">
            
                <a href="../Docker/docker笔记.html#基础操作">
            
                    
                    Docker基础操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../Docker/docker笔记.html">
            
                <a href="../Docker/docker笔记.html#dockerfile">
            
                    
                    DockerFile
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../category/Web.html">
            
                <a href="../category/Web.html">
            
                    
                    Web
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../运维/Http入坑Https笔记.html">
            
                <a href="../运维/Http入坑Https笔记.html">
            
                    
                    Http入坑Https笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../Web/阿里云OSS.html">
            
                <a href="../Web/阿里云OSS.html">
            
                    
                    OSS
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../category/java基础.html">
            
                <a href="../category/java基础.html">
            
                    
                    Java基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../Java-Base/Java基础.html">
            
                <a href="../Java-Base/Java基础.html#jvm">
            
                    
                    JVM基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../Java-Base/Java基础.html">
            
                <a href="../Java-Base/Java基础.html#语法糖">
            
                    
                    Java语法糖
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../Java-Base/Java基础.html">
            
                <a href="../Java-Base/Java基础.html#数据结构">
            
                    
                    Java数据结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../Java-Base/Java8函数式编程.html">
            
                <a href="../Java-Base/Java8函数式编程.html">
            
                    
                    java8函数式编程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../Java-Base/ArrayList源码分析.html">
            
                <a href="../Java-Base/ArrayList源码分析.html">
            
                    
                    JDK源码分析ArrayList
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" data-path="../Java-Base/HashMap源码分析.html">
            
                <a href="../Java-Base/HashMap源码分析.html">
            
                    
                    JDK源码分析HashMap
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" data-path="../Java-Base/Java注解.html">
            
                <a href="../Java-Base/Java注解.html">
            
                    
                    Java注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.8" data-path="../Java-Base/Timsort排序算法.html">
            
                <a href="../Java-Base/Timsort排序算法.html">
            
                    
                    Timsort排序算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.9" data-path="../Java-Base/插入排序分析与Java实现.html">
            
                <a href="../Java-Base/插入排序分析与Java实现.html">
            
                    
                    插入排序分析与Java实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../category/工具与规范.html">
            
                <a href="../category/工具与规范.html">
            
                    
                    工具与规范
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../工具/Maven使用技巧汇总.html">
            
                <a href="../工具/Maven使用技巧汇总.html">
            
                    
                    Maven使用技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../编码规范/Java编码规范.html">
            
                <a href="../编码规范/Java编码规范.html">
            
                    
                    Java编码规范
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../category/OLAP.html">
            
                <a href="../category/OLAP.html">
            
                    
                    OLAP
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../数据处理/storm学习笔记.html">
            
                <a href="../数据处理/storm学习笔记.html">
            
                    
                    流式计算Storm学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../category/数据运营.html">
            
                <a href="../category/数据运营.html">
            
                    
                    数据运营
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../数据运营/增长黑客数据运营.html">
            
                <a href="../数据运营/增长黑客数据运营.html">
            
                    
                    增长黑客-数据运营
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../category/前端技术栈.html">
            
                <a href="../category/前端技术栈.html">
            
                    
                    前端技术栈
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../前端/JavaScript设计模式.html">
            
                <a href="../前端/JavaScript设计模式.html">
            
                    
                    JavaScript设计模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../前端/html相对路径与绝对路径.html">
            
                <a href="../前端/html相对路径与绝对路径.html">
            
                    
                    Html相对路径与绝对路径
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.3" data-path="../前端/微信小程序学习笔记.html">
            
                <a href="../前端/微信小程序学习笔记.html">
            
                    
                    微信小程序学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../category/个人.html">
            
                <a href="../category/个人.html">
            
                    
                    个人
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../个人/简历.html">
            
                <a href="../个人/简历.html">
            
                    
                    简历
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >位运算应用实例</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x4F4D;&#x8FD0;&#x7B97;&#x5E94;&#x7528;&#x5B9E;&#x4F8B;">&#x4F4D;&#x8FD0;&#x7B97;&#x5E94;&#x7528;&#x5B9E;&#x4F8B;</h1>
<h2 id="&#x4E8C;&#x8FDB;&#x5236;&#x57FA;&#x7840;">&#x4E8C;&#x8FDB;&#x5236;&#x57FA;&#x7840;</h2>
<h3 id="&#x5341;&#x8FDB;&#x5236;&#x4E0E;&#x4E8C;&#x8FDB;&#x5236;&#x7684;&#x8F6C;&#x6362;">&#x5341;&#x8FDB;&#x5236;&#x4E0E;&#x4E8C;&#x8FDB;&#x5236;&#x7684;&#x8F6C;&#x6362;</h3>
<p><strong>10&#x6362;2&#x8981;&#x8BC0;</strong>&#xFF1A;&#x9664;&#x4E8C;&#x53D6;&#x4F59;&#xFF0C;&#x7136;&#x540E;&#x5012;&#x5E8F;&#x6392;&#x5217;&#xFF0C;&#x9AD8;&#x4F4D;&#x8865;&#x96F6;</p>
<p>&#x4F8B;&#x5982;&#xFF1A;&#x5341;&#x8FDB;&#x5236;<code>52</code>&#x6362;&#x7B97;&#x7ED3;&#x679C;&#x4E3A;<code>110100</code></p>
<p><img src="https://gss0.baidu.com/7Po3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/54fbb2fb43166d223899e186462309f79052d232.jpg" alt="10&#x6362;2"></p>
<p><strong>2&#x6362;10&#x8981;&#x8BC0;</strong>&#xFF1A;</p>
<p>2&#x6362;10&#x8981;&#x8BC0;&#xFF1A;&#x4ECE;&#x4F4E;&#x4F4D;&#xFF08;&#x53F3;&#x8FB9;&#xFF09;&#x7B97;&#x8D77;&#x4F4D;&#x7F6E;&#x4E0B;&#x6807;&#x4E3A;<code>n</code>&#xFF0C;2&#x7684;<code>a</code>&#x5E42;&#x6B21;&#x65B9; &#x4E58;&#x4EE5;&#x4E8C;&#x8FDB;&#x5236;&#x5BF9;&#x5E94;&#x4F4D;&#x7684;&#x6570;&#x503C;<code>a</code>[0&#x6216;1]&#xFF0C;&#x518D;&#x6C42;&#x5404;&#x4E2A;&#x4F4D;&#x4E4B;&#x548C;&#xFF0C;&#x516C;&#x5F0F;&#x4E3A;&#xFF08;&#x6682;&#x65F6;&#x5199;&#x4E0D;&#x51FA;&#xFF09;&#xFF1A;</p>
<p>$$\sum_{i=0}^n a_i= 2 ^n-1 $$</p>
<p>&#x4F8B;&#x5982;&#xFF1A;&#x4E8C;&#x8FDB;&#x5236;<code>110</code>&#x6362;&#x7B97;&#x7ED3;&#x679C;&#x4E3A;6</p>
<p><img src="http://image24.360doc.com/DownloadImg/2011/03/0814/9796997_4.jpg" alt="2&#x6362;10"></p>
<p>$$(2^2 <em> 1) + (2^1 </em> 1) + (2^0 * 0) = 4 + 2 + 0 = 6$$ </p>
<hr>
<h3 id="&#x4F4D;&#x8FD0;&#x7B97;">&#x4F4D;&#x8FD0;&#x7B97;</h3>
<table>
<thead>
<tr>
<th>&#x8FD0;&#x7B97;&#x7B26;</th>
<th>&#x542B;&#x4E49;</th>
<th>&#x529F;&#x80FD;</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>&amp;</code></td>
<td>&#x6309;&#x4F4D;&#x4E0E;</td>
<td>&#x5982;&#x679C;&#x4E24;&#x4E2A;&#x76F8;&#x5E94;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x4F4D;&#x90FD;&#x4E3A;&#xFF11;&#xFF0C;&#x5219;&#x8BE5;&#x4F4D;&#x7684;&#x7ED3;&#x679C;&#x503C;&#x4E3A;&#xFF11;&#xFF1B;&#x5426;&#x5219;&#x4E3A;&#xFF10;&#x3002;</td>
</tr>
<tr>
<td>`\</td>
<td>`</td>
<td>&#x6309;&#x4F4D;&#x6216;</td>
<td>&#x4E24;&#x4E2A;&#x76F8;&#x5E94;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x4F4D;&#x4E2D;&#x53EA;&#x8981;&#x6709;&#x4E00;&#x4E2A;&#x4E3A;&#xFF11;&#xFF0C;&#x8BE5;&#x4F4D;&#x7684;&#x7ED3;&#x679C;&#x503C;&#x4E3A;&#xFF11;&#x3002;</td>
</tr>
<tr>
<td><code>&#x2227;</code></td>
<td>&#x6309;&#x4F4D;&#x5F02;&#x6216;</td>
<td>&#x82E5;&#x53C2;&#x52A0;&#x8FD0;&#x7B97;&#x7684;&#x4E24;&#x4E2A;&#x4E8C;&#x8FDB;&#x5236;&#x4F4D;&#x540C;&#x53F7;&#x5219;&#x7ED3;&#x679C;&#x4E3A;&#xFF10;&#xFF08;&#x5047;&#xFF09;&#x5F02;&#x53F7;&#x5219;&#x7ED3;&#x679C;&#x4E3A;&#xFF11;&#xFF08;&#x771F;&#xFF09;</td>
</tr>
<tr>
<td><code>&#xFF5E;</code></td>
<td>&#x53D6;&#x53CD;</td>
<td><code>&#xFF5E;</code>&#x662F;&#x4E00;&#x4E2A;&#x5355;&#x76EE;&#xFF08;&#x5143;&#xFF09;&#x8FD0;&#x7B97;&#x7B26;&#xFF0C;&#x7528;&#x6765;&#x5BF9;&#x4E00;&#x4E2A;&#x4E8C;&#x8FDB;&#x5236;&#x6570;&#x6309;&#x4F4D;&#x53D6;&#x53CD;&#xFF0C;&#x5373;&#x5C06;&#xFF10;&#x53D8;&#xFF11;&#xFF0C;&#x5C06;&#xFF11;&#x53D8;&#xFF10;&#x3002;</td>
</tr>
<tr>
<td><code>&lt;&lt;</code></td>
<td>&#x5DE6;&#x79FB;</td>
<td>&#x5DE6;&#x79FB;&#x8FD0;&#x7B97;&#x7B26;&#x662F;&#x7528;&#x6765;&#x5C06;&#x4E00;&#x4E2A;&#x6570;&#x7684;&#x5404;&#x4E8C;&#x8FDB;&#x5236;&#x4F4D;&#x5168;&#x90E8;&#x5DE6;&#x79FB;N&#x4F4D;&#xFF0C;&#x53F3;&#x8865;&#xFF10;&#x3002;</td>
</tr>
<tr>
<td><code>&gt;&gt;</code></td>
<td>&#x53F3;&#x79FB;</td>
<td>&#x8868;&#x793A;&#x5C06;a&#x7684;&#x5404;&#x4E8C;&#x8FDB;&#x5236;&#x4F4D;&#x53F3;&#x79FB;N&#x4F4D;&#xFF0C;&#x79FB;&#x5230;&#x53F3;&#x7AEF;&#x7684;&#x4F4E;&#x4F4D;&#x88AB;&#x820D;&#x5F03;,&#x5BF9;&#x65E0;&#x7B26;&#x53F7;&#x6570;,&#x9AD8;&#x4F4D;&#x8865;0&#x3002;</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>&#x4E0E;<code>&amp;</code>&#x8FD0;&#x7B97;</th>
<th style="text-align:center"></th>
<th style="text-align:center"></th>
<th style="text-align:center"></th>
</tr>
</thead>
<tbody>
<tr>
<td>&#x6837;&#x672C;&#x6570;1</td>
<td style="text-align:center">111&#x3010;7&#x3011;</td>
<td style="text-align:center">111&#x3010;7&#x3011;</td>
<td style="text-align:center">1000&#x3010;8&#x3011;</td>
</tr>
<tr>
<td>&#x6837;&#x672C;&#x6570;2</td>
<td style="text-align:center">010&#x3010;2&#x3011;</td>
<td style="text-align:center">101&#x3010;5&#x3011;</td>
<td style="text-align:center">0101&#x3010;5&#x3011;</td>
</tr>
<tr>
<td>&#x64CD;&#x4F5C;&#x7ED3;&#x679C;</td>
<td style="text-align:center">010&#x3010;2&#x3011;</td>
<td style="text-align:center">101&#x3010;5&#x3011;</td>
<td style="text-align:center">0000&#x3010;0&#x3011;</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>&#x6216;`\</th>
<th style="text-align:center">`&#x8FD0;&#x7B97;</th>
<th style="text-align:center"></th>
<th style="text-align:center"></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>&#x6837;&#x672C;&#x6570;1</td>
<td style="text-align:center">111&#x3010;7&#x3011;</td>
<td style="text-align:center">111&#x3010;7&#x3011;</td>
<td style="text-align:center">1000&#x3010;8&#x3011;</td>
</tr>
<tr>
<td>&#x6837;&#x672C;&#x6570;2</td>
<td style="text-align:center">010&#x3010;2&#x3011;</td>
<td style="text-align:center">101&#x3010;5&#x3011;</td>
<td style="text-align:center">0101&#x3010;5&#x3011;</td>
</tr>
<tr>
<td>&#x64CD;&#x4F5C;&#x7ED3;&#x679C;</td>
<td style="text-align:center">111&#x3010;7&#x3011;</td>
<td style="text-align:center">111&#x3010;7&#x3011;</td>
<td style="text-align:center">1101&#x3010;13&#x3011;</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>&#x6216;<code>&gt;&gt;</code>&#x8FD0;&#x7B97;</th>
<th style="text-align:center"></th>
<th style="text-align:center"></th>
<th style="text-align:center"></th>
</tr>
</thead>
<tbody>
<tr>
<td>&#x6837;&#x672C;&#x6570;a</td>
<td style="text-align:center">11111&#x3010;31&#x3011;</td>
<td style="text-align:center">111&#x3010;7&#x3011;</td>
<td style="text-align:center">100000&#x3010;32&#x3011;</td>
<td>1000&#x3010;8&#x3011;</td>
</tr>
<tr>
<td>&#x64CD;&#x4F5C;</td>
<td style="text-align:center"><code>&gt;&gt;2</code></td>
<td style="text-align:center"><code>&gt;&gt;2</code></td>
<td style="text-align:center"><code>&gt;&gt;2</code></td>
<td><code>&gt;&gt;2</code></td>
</tr>
<tr>
<td>&#x7ED3;&#x679C;</td>
<td style="text-align:center">00111&#x3010;7&#x3011;</td>
<td style="text-align:center">001&#x3010;1&#x3011;</td>
<td style="text-align:center">1000&#x3010;8&#x3011;</td>
<td>10&#x3010;2&#x3011;</td>
</tr>
</tbody>
</table>
<blockquote>
<p>PS&#xFF1A;&#x5BF9;&#x4E8E;&#x4E8C;&#x8FDB;&#x5236;&#x7684;&#x5B66;&#x4E60;&#x5EFA;&#x8BAE;&#x662F;&#xFF1A;&#x65F6;&#x523B;&#x53C2;&#x8003;0&#x5230;7&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x6570;&#x503C;&#xFF1B;&#x5BF9;&#x719F;&#x8BC6;&#x89C4;&#x5F8B;&#x3001;&#x5206;&#x6790;&#x903B;&#x8F91;&#x6709;&#x5927;&#x5E2E;&#x52A9;
000&#x3010;0&#x3011;
001&#x3010;1&#x3011;
010&#x3010;2&#x3011;
011&#x3010;3&#x3011;
100&#x3010;4&#x3011;
101&#x3010;5&#x3011;
110&#x3010;6&#x3011;
111&#x3010;7&#x3011;</p>
</blockquote>
<hr>
<h2 id="&#x5E94;&#x7528;&#x4F8B;&#x5B50;">&#x5E94;&#x7528;&#x4F8B;&#x5B50;</h2>
<h3 id="1&#x3001;&#x5947;&#x5076;&#x6570;&#x5224;&#x65AD;">1&#x3001;&#x5947;&#x5076;&#x6570;&#x5224;&#x65AD;</h3>
<p>&#x5E38;&#x89C1;&#x505A;&#x6CD5;&#x5BF9;2&#x53D6;&#x4F59;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">if</span>(value % <span class="hljs-number">2</span> == <span class="hljs-number">0</span>){
   <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;
}
<span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
</code></pre>
<p>&#x5982;&#x679C;&#x64CD;&#x4F5C;&#x6570;value&#x662F;&#x5C0F;&#x6570;&#x7684;&#x8BDD;&#xFF0C;&#x8FD8;&#x52C9;&#x5F3A;&#x884C;&#x5F97;&#x901A;&#xFF0C;&#x4F46;&#x662F;value&#x662F;&#x4E00;&#x4E2A;&#x4E0A;&#x767E;&#x4E07;&#x7684;&#x5927;&#x6570;&#xFF0C;&#x90A3;&#x4E48;&#x8FD9;&#x5C31;&#x767D;&#x767D;&#x6D6A;&#x8D39;&#x4E86;CPU&#x7684;&#x5927;&#x91CF;&#x65F6;&#x95F4;&#xFF0C;&#x7A0B;&#x5E8F;&#x7684;&#x6548;&#x7387;&#x548C;&#x6027;&#x80FD;&#x5C31;&#x5F88;&#x5DEE;&#x3002;&#x56DE;&#x5934;&#x89C2;&#x5BDF;0&#x81F3;7&#x4E8C;&#x8FDB;&#x5236;&#x5BF9;&#x7167;&#x8868;&#xFF0C;&#x53EF;&#x4EE5;&#x53D1;&#x73B0;&#x89C4;&#x5F8B;&#xFF1A;&#x5076;&#x6570;&#x4E8C;&#x8FDB;&#x5236;&#x4E2A;&#x4F4D;&#x6570;&#x6052;&#x4E3A;0&#xFF0C;&#x800C;&#x5947;&#x6570;&#x4E2A;&#x4F4D;&#x6570;&#x6052;&#x4E3A;0&#x3002;&#x800C;&#x901A;&#x8FC7;<strong>&#x4E0E;</strong>&#x8FD0;&#x7B97;&#x53EF;&#x5F97;&#x63A8;&#x8BBA;&#xFF1A;</p>
<blockquote>
<p><code>&#x4EFB;&#x610F;&#x5076;&#x6570; &amp; 1 = 0</code>
<code>&#x4EFB;&#x610F;&#x5947;&#x6570; &amp; 1 = 1</code></p>
</blockquote>
<p>&#x5BF9;2&#x53D6;&#x4F59;&#x65B9;&#x6CD5;&#x53EF;&#x4EE5;&#x6539;&#x4E3A;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">if</span>(value &amp; <span class="hljs-number">1</span> == <span class="hljs-number">0</span>){
   <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;
}
<span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
</code></pre>
<hr>
<h3 id="2&#x3001;&#x8BB0;&#x5F55;&#x6D77;&#x91CF;&#x70ED;&#x6570;&#x636E;&#x72B6;&#x6001;">2&#x3001;&#x8BB0;&#x5F55;&#x6D77;&#x91CF;&#x70ED;&#x6570;&#x636E;&#x72B6;&#x6001;</h3>
<p>&#x4ECE;Redis 2.2&#x5F00;&#x59CB;&#xFF0C;Redis&#x63D0;&#x4F9B;&#x4E86;GETRANGE/SETRANGE/GETBIT/SETBIT&#x56DB;&#x4E2A;&#x7528;&#x4E8E;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;Key/Value&#x7684;&#x547D;&#x4EE4;&#x3002;&#x901A;&#x8FC7;&#x8FD9;&#x4E9B;&#x547D;&#x4EE4;&#xFF0C;&#x6211;&#x4EEC;&#x4FBF;&#x53EF;&#x4EE5;&#x50CF;&#x64CD;&#x4F5C;&#x6570;&#x7EC4;&#x90A3;&#x6837;&#x6765;&#x8BBF;&#x95EE;String&#x7C7B;&#x578B;&#x7684;&#x503C;&#x6570;&#x636E;&#x4E86;&#x3002;&#x6BD4;&#x5982;&#x552F;&#x4E00;&#x6807;&#x8BC6;&#x7528;&#x6237;&#x8EAB;&#x4EFD;&#x7684;ID&#xFF0C;&#x53EF;&#x80FD;&#x4EC5;&#x4EC5;&#x662F;String&#x503C;&#x7684;&#x5176;&#x4E2D;&#x4E00;&#x6BB5;&#x5B50;&#x5B57;&#x7B26;&#x4E32;&#x3002;&#x8FD9;&#x6837;&#x5C31;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;GETRANGE/SETRANGE&#x547D;&#x4EE4;&#x6765;&#x65B9;&#x4FBF;&#x7684;&#x63D0;&#x53D6;&#x3002;&#x518D;&#x6709;&#x5C31;&#x662F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;BITMAP&#x6765;&#x8868;&#x793A;&#x7528;&#x6237;&#x67D0;&#x5929;&#x7684;&#x662F;&#x5426;&#x767B;&#x5F55;&#x72B6;&#x6001;&#xFF0C;&#x5982;1&#x8868;&#x793A;&#x6709;&#x767B;&#x5F55;&#xFF0C;0&#x8868;&#x793A;&#x6CA1;&#x767B;&#x5F55;&#x3002;&#x7528;&#x8FD9;&#x79CD;&#x65B9;&#x5F0F;&#x6765;&#x8868;&#x793A;100,000,000&#x4E2A;&#x7528;&#x6237;&#x7684;&#x65F6;&#xFF0C;&#x4E5F;&#x4EC5;&#x4EC5;&#x5360;&#x7528;12MB&#x7684;&#x5B58;&#x50A8;&#x7A7A;&#x95F4;&#xFF0C;&#x4E0E;&#x6B64;&#x540C;&#x65F6;&#xFF0C;&#x5728;&#x901A;&#x8FC7;SETBIT/GETBIT&#x547D;&#x4EE4;&#x8FDB;&#x884C;&#x6570;&#x636E;&#x904D;&#x5386;&#x4E5F;&#x662F;&#x975E;&#x5E38;&#x9AD8;&#x6548;&#x7684;&#x3002;</p>
<p>&#x5B9E;&#x6D4B;Redis&#x63D2;&#x5165;100,000,000&#x4F4D;Bitmap&#xFF0C;&#x5360;&#x7528;&#x5185;&#x5B58;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code># Memory
used_memory:14389312
used_memory_human:13.72M
used_memory_rss:14389312
used_memory_peak:14457332
used_memory_peak_human:13.79M
used_memory_lua:31744
mem_allocator:libc
</code></pre><hr>
<h3 id="3&#x3001;&#x5FEB;&#x901F;&#x53BB;&#x91CD;&#x6392;&#x5E8F;">3&#x3001;&#x5FEB;&#x901F;&#x53BB;&#x91CD;&#x6392;&#x5E8F;</h3>
<p>&#x5229;&#x7528;JDK&#x65B9;&#x6CD5;&#x5B9E;&#x73B0;&#x6574;&#x6570;&#x53BB;&#x91CD;&#x6392;&#x5E8F;&#x65B9;&#x6CD5;&#xFF0C;JDK7&#x4EE5;&#x540E;&#x9ED8;&#x8BA4;&#x6392;&#x5E8F;&#x65B9;&#x6CD5;&#x4E3A;Timsort&#xFF0C;&#x672C;&#x8D28;&#x662F;&#x4E8C;&#x5206;&#x6CD5;&#x63D2;&#x5165;&#x6392;&#x5E8F;&#x4E0E;&#x5F52;&#x5E76;&#x6392;&#x5E8F;&#x7684;&#x7ED3;&#x5408;&#xFF0C;&#x65F6;&#x95F4;&#x590D;&#x6742;&#x5EA6;&#x662F;O(n log n)&#xFF1B;&#x4EE5;&#x4E0B;&#x5B9E;&#x73B0;&#x4F8B;&#x5B50;&#x4E0D;&#x8003;&#x8651;&#x5229;&#x7528;Map&#x8FDB;&#x884C;&#x53BB;&#x91CD;&#x3002;</p>
<pre><code class="lang-java">    <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">static</span> List&lt;Integer&gt; <span class="hljs-title">fnJDKSort</span><span class="hljs-params">(Integer[] arr)</span> </span>{
        <span class="hljs-comment">//&#x9996;&#x5148;&#x5229;&#x7528;Stream.distinct()&#x8FDB;&#x884C;&#x53BB;&#x91CD;&#xFF0C;&#x6682;&#x65F6;&#x4E0D;&#x8003;&#x8651;&#x7528;Set&#x63A5;&#x53E3;</span>
        List&lt;Integer&gt; list = Arrays.asList(arr).stream().distinct().collect(Collectors.toList());

        <span class="hljs-comment">//&#x518D;&#x6392;&#x5E8F;</span>
        Collections.sort(list, <span class="hljs-keyword">new</span> Comparator&lt;Integer&gt;() {
            <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">int</span> <span class="hljs-title">compare</span><span class="hljs-params">(Integer o1, Integer o2)</span> </span>{ <span class="hljs-keyword">if</span> (o2 &gt; o1) { <span class="hljs-keyword">return</span> -<span class="hljs-number">1</span>; } <span class="hljs-keyword">return</span> <span class="hljs-number">1</span>&#xFF1B;}
        });

        <span class="hljs-keyword">return</span> list;
    }
</code></pre>
<p>&#x65E0;&#x8BBA;&#x4F55;&#x79CD;&#x6392;&#x5E8F;&#x7B97;&#x6CD5;&#xFF0C;&#x90FD;&#x4F1A;&#x6D89;&#x53CA;&#x5143;&#x7D20;&#x4E4B;&#x95F4;&#x7684;&#x6BD4;&#x8F83;&#x52A8;&#x4F5C;&#xFF1B;&#x800C;&#x53CD;&#x89C2;&#x4F4D;&#x56FE;&#xFF0C;&#x7531;&#x4E8E;&#x4F4D;&#x56FE;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;&#xFF0C;&#x4F4D;&#x56FE;&#x5177;&#x6709;&#x7684;&#x4EE5;&#x4E0B;&#x4E24;&#x70B9;&#x7279;&#x6027;&#x53EF;&#x4EE5;&#x5E2E;&#x52A9;&#x5B9E;&#x73B0;&#x65E0;&#x9700;&#x901A;&#x8FC7;&#x5143;&#x7D20;&#x6BD4;&#x8F83;&#xFF0C;&#x65F6;&#x95F4;&#x590D;&#x6742;&#x5EA6;&#x4E3A;O(1)&#x7684;&#x6392;&#x5E8F;&#x65B9;&#x6CD5;&#xFF1A;</p>
<ol>
<li>&#x5FEB;&#x901F;&#x968F;&#x673A;&#x8BBF;&#x95EE;&#x4F4D;</li>
<li>&#x4F4D;&#x7684;&#x6709;&#x5E8F;&#x6027;</li>
</ol>
<p>&#x5B9E;&#x73B0;&#x6B65;&#x9AA4;&#xFF1A;
&#x7B2C;&#x4E00;&#x9636;&#x6BB5;&#x5C06;&#x6240;&#x6709;&#x7684;&#x4F4D;&#x90FD;&#x7F6E;&#x4E3A;0&#xFF0C;&#x4ECE;&#x800C;&#x5C06;&#x96C6;&#x5408;&#x521D;&#x59CB;&#x5316;&#x4E3A;&#x7A7A;&#xFF1B;
&#x7B2C;&#x4E8C;&#x9636;&#x6BB5;&#x901A;&#x8FC7;&#x8BFB;&#x5165;&#x968F;&#x673A;&#x96C6;&#x5408;&#x7684;&#x6BCF;&#x4E2A;&#x6574;&#x6570;&#x6765;&#x5EFA;&#x7ACB;&#x96C6;&#x5408;&#xFF0C;&#x5C06;&#x6BCF;&#x4E2A;&#x5BF9;&#x5E94;&#x7684;&#x4F4D;&#x90FD;&#x7F6E;&#x4E3A;1&#xFF1B;
&#x7B2C;&#x4E09;&#x9636;&#x6BB5;&#x68C0;&#x9A8C;&#x6BCF;&#x4E00;&#x4F4D;&#xFF0C;&#x5982;&#x679C;&#x8BE5;&#x4F4D;&#x4E3A;1&#xFF0C;&#x5C31;&#x8F93;&#x51FA;&#x5BF9;&#x5E94;&#x7684;&#x6574;&#x6570;&#xFF0C;&#x7531;&#x6B64;&#x4EA7;&#x751F;&#x6709;&#x5E8F;&#x7684;&#x8F93;&#x51FA;&#x7ED3;&#x679C;&#x3002;</p>
<pre><code class="lang-java">    <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">static</span> List&lt;Integer&gt; <span class="hljs-title">fnBitSet</span><span class="hljs-params">(Integer[] arr)</span> </span>{
        <span class="hljs-keyword">final</span> BitSet bitSet = <span class="hljs-keyword">new</span> BitSet();
        List&lt;Integer&gt; list = <span class="hljs-keyword">new</span> ArrayList&lt;&gt;();
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>; i &lt; arr.length; i++) {
            bitSet.set(arr[i], <span class="hljs-keyword">true</span>);
        }

        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>; i &lt; arr.length; i++) {
            <span class="hljs-keyword">if</span> (bitSet.get(i)) {
                list.add(i);
            }
        }
        <span class="hljs-keyword">return</span> list;
    }
</code></pre>
<p>&#x4E24;&#x79CD;&#x65B9;&#x6CD5;&#x6027;&#x80FD;&#x8017;&#x65F6;&#x5BF9;&#x6BD4;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>&#x6837;&#x672C;&#x91CF;</th>
<th>Sort(ms)</th>
<th>BitMap&#xFF08;ms&#xFF09;</th>
</tr>
</thead>
<tbody>
<tr>
<td>1000&#xFF0C;1&#x5343;</td>
<td>80</td>
<td>1</td>
</tr>
<tr>
<td>10000&#xFF0C;1&#x4E07;</td>
<td>165</td>
<td>4</td>
</tr>
<tr>
<td>100000&#xFF0C;10&#x4E07;</td>
<td>180</td>
<td>20</td>
</tr>
<tr>
<td>1000000&#xFF0C;100&#x4E07;</td>
<td>530</td>
<td>120</td>
</tr>
</tbody>
</table>
<hr>
<h3 id="4&#x3001;&#x5206;&#x7EC4;&#x8FD0;&#x7B97;">4&#x3001;&#x5206;&#x7EC4;&#x8FD0;&#x7B97;</h3>
<p><strong>&#x5206;&#x7EC4;&#x8FD0;&#x7B97;</strong>&#xFF1A;&#x6839;&#x636E;&#x67D0;&#x4E2A;&#x6216;&#x591A;&#x4E2A;&#x7279;&#x5F81;&#x503C;&#x5BF9;&#x6570;&#x636E;&#x96C6;&#x5408;&#x8FDB;&#x884C;&#x5212;&#x5206;&#x5206;&#x7EC4;&#xFF0C;&#x76EE;&#x6807;&#x662F;&#x63D0;&#x5347;&#x6570;&#x636E;&#x8BBF;&#x95EE;&#x4E0E;&#x5B58;&#x50A8;&#x6548;&#x7387;&#x3002;&#x5E38;&#x89C1;&#x5E94;&#x7528;&#x573A;&#x666F;&#xFF1A;</p>
<ol>
<li>&#x6570;&#x636E;&#x5E93;&#x5206;&#x7247;</li>
<li>Hash&#x6563;&#x5217;&#x4F4D;&#x7F6E;&#x4E0B;&#x6807;&#x8BA1;&#x7B97;</li>
<li>&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x968F;&#x673A;&#x5206;&#x7EC4;</li>
</ol>
<p>Hash&#x6563;&#x5217;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x662F;&#x901A;&#x8FC7;&#x6570;&#x7EC4;&#x4E0E;&#x94FE;&#x8868;&#x7684;&#x7EC4;&#x5408;&#xFF08;&#x94FE;&#x8868;&#x7684;&#x6570;&#x7EC4;&#x96C6;&#xFF09;&#xFF0C;&#x901A;&#x8FC7;&#x5BF9;&#x8C61;&#x7684;<strong>&#x6563;&#x5217;&#x7801;</strong>&#x5B9A;&#x4F4D;&#x5BF9;&#x8C61;&#x5728;&#x6570;&#x7EC4;&#x4E2D;&#x7684;&#x4F4D;&#x7F6E;&#x4E0B;&#x6807;&#xFF0C;&#x540C;&#x4E00;&#x4F4D;&#x7F6E;&#x4E0B;&#x6807;&#x7684;&#x591A;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x5219;&#x4EE5;&#x94FE;&#x8868;&#x5F62;&#x5F0F;&#x5B58;&#x50A8;&#xFF0C;&#x56E0;&#x6B64;&#xFF0C;&#x5982;&#x4F55;&#x5229;&#x7528;&#x5BF9;&#x8C61;&#x7684;<strong>&#x6563;&#x5217;&#x7801;</strong>&#x53EF;&#x4EE5;&#x5747;&#x5300;&#x5B9A;&#x4F4D;&#x5230;&#x6570;&#x7EC4;&#x4E0D;&#x540C;&#x4F4D;&#x7F6E;&#x4E2D;&#xFF0C;&#x51CF;&#x5C11;&#x7531;&#x4E8E;&#x51B2;&#x7A81;&#x800C;&#x751F;&#x6210;&#x94FE;&#x8868;&#xFF0C;&#x662F;Hash&#x6563;&#x5217;&#x51FD;&#x6570;&#x7684;&#x5173;&#x952E;&#x7B97;&#x6CD5;&#x3002;</p>
<p><img src="http://dl.iteye.com/upload/attachment/175449/66679083-1285-397d-860a-83fc41efeedd.jpg" alt="Hash&#x7ED3;&#x6784;&#x8BF4;&#x660E;"></p>
<p>Hashtable&#x91C7;&#x7528;&#x6700;&#x5E38;&#x89C1;&#x7B97;&#x6CD5;&#x6709;<strong>&#x9664;&#x7559;&#x4F59;&#x6570;&#x6CD5;</strong>&#xFF0C;&#x800C;HashMap&#x5219;&#x901A;&#x8FC7;&#x6548;&#x7387;&#x66F4;&#x9AD8;&#x66F4;&#x5DE7;&#x5999;<strong>&#x4F4D;&#x8FD0;&#x7B97;&#x6CD5;</strong>&#xFF0C;&#x540C;&#x6837;&#x5B9E;&#x73B0;&#x4E86;&#x5747;&#x5300;&#x7684;&#x6563;&#x5217;&#x3002;&#x5173;&#x4E8E;<strong>&#x9664;&#x7559;&#x4F59;&#x6570;&#x6CD5;</strong>&#x66F4;&#x591A;&#x5206;&#x6790;&#x4EE5;&#x53CA;&#x4E24;&#x79CD;&#x7B97;&#x6CD5;&#x7684;&#x4F18;&#x52A3;&#x5BF9;&#x6BD4;&#x53C2;&#x8003;&#xFF1A;<a href="http://blog.csdn.net/wangpengqi/article/details/9714207" target="_blank">&#x6563;&#x5217;&#x51FD;&#x6570;&#x8BBE;&#x8BA1;&#xFF1A;&#x9664;&#x7559;&#x4F59;&#x6570;&#x6CD5;</a>&#xFF0C;&#x4F46;&#x4F59;&#x6570;&#x6CD5;&#x5E76;&#x975E;&#x672C;&#x6587;&#x8BA8;&#x8BBA;&#x91CD;&#x70B9;&#xFF0C;&#x7559;&#x5F85;&#x66F4;&#x591A;&#x5B9E;&#x9A8C;&#x4E0E;&#x8BA8;&#x8BBA;&#x3002;</p>
<p>HashMap&#x4F4D;&#x7B97;&#x6CD5;&#x975E;&#x5E38;&#x7B80;&#x5355;&#xFF1A;<code>&#x6570;&#x7EC4;&#x4F4D;&#x7F6E;&#x4E0B;&#x6807; = &#x6563;&#x5217;&#x7801; &amp; (&#x6570;&#x7EC4;&#x957F;&#x5EA6; - 1)</code>&#x3002;&#x53C2;&#x8003;&#x6E90;&#x7801;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-keyword">int</span> n = (tab = resize()).length; <span class="hljs-comment">//Hash&#x6570;&#x7EC4;&#x957F;&#x5EA6;</span>
Node&lt;K,V&gt; p  = tab[i = (n - <span class="hljs-number">1</span>) &amp; hash];
</code></pre>
<p>&#x5F53;HashMap&#x521D;&#x59CB;&#x5316;&#x65F6;&#xFF0C;&#x6570;&#x7EC4;&#x9ED8;&#x8BA4;&#x957F;&#x5EA6;&#x4E3A;16&#xFF0C;&#x8FD0;&#x7B97;&#x516C;&#x5F0F;&#x4E3A;&#xFF1A;<code>16-1 &amp; hash</code>&#xFF0C;&#x53C2;&#x8003;&#x4EE5;&#x4E0B;&#x793A;&#x4F8B;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>&#x6563;&#x5217;&#x7801;</th>
<th>&#x8FD0;&#x7B97;</th>
<th>&#x7ED3;&#x679C;</th>
</tr>
</thead>
<tbody>
<tr>
<td>10001101&#x3010;141&#x3011;</td>
<td>1111 &amp; 10001101</td>
<td>1101&#x3010;13&#x3011;</td>
</tr>
<tr>
<td>10001110&#x3010;142&#x3011;</td>
<td>1111 &amp; 10001110</td>
<td>1110&#x3010;14&#x3011;</td>
</tr>
<tr>
<td>10001111&#x3010;143&#x3011;</td>
<td>1111 &amp; 10001111</td>
<td>1111&#x3010;15&#x3011;</td>
</tr>
<tr>
<td>10010000&#x3010;144&#x3011;</td>
<td>1111 &amp; 10010000</td>
<td>0000&#x3010;0&#x3011;</td>
</tr>
<tr>
<td>10010001&#x3010;145&#x3011;</td>
<td>1111 &amp; 10010001</td>
<td>0000&#x3010;1&#x3011;</td>
</tr>
</tbody>
</table>
<p>&#x5DE7;&#x5999;&#x4E4B;&#x5904;&#x5728;&#x4E8E;&#x4EE5;&#x4E0B;&#x4E24;&#x70B9;&#xFF1A;</p>
<p>1&#x3001;&#x6839;&#x636E;HashMap&#x7684;&#x8BBE;&#x8BA1;&#xFF0C;&#x5176;&#x6570;&#x7EC4;&#x7684;&#x957F;&#x5EA6;length&#x5FC5;&#x7136;&#x4E3A;2&#x7684;&#x6574;&#x6570;&#x6B21;&#x5E42;&#xFF0C;&#x786E;&#x4FDD;&#x4E86;<code>length - 1</code>&#x4E3A;&#x5947;&#x6570;&#xFF0C;&#x5947;&#x6570;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x6700;&#x540E;&#x4E00;&#x4F4D;&#x5C3E;&#x6570;&#x5FC5;&#x4E3A;1&#xFF0C;&#x6240;&#x4EE5;&#x6563;&#x5217;&#x7801;&#x7684;&#x6700;&#x540E;&#x4E00;&#x4F4D;&#x65E0;&#x8BBA;&#x662F;1&#x6216;&#x662F;0&#xFF0C;<strong>&#x4E0E;</strong>&#x8FD0;&#x7B97;&#x7ED3;&#x679C;&#x90FD;&#x4F1A;&#x4EA7;&#x751F;1&#x6216;0&#x7684;&#x7ED3;&#x679C;&#x3002;&#x53CD;&#x4E4B;&#xFF0C;&#x5982;&#x679C;Length&#x4E3A;&#x5076;&#x6570;&#xFF0C;&#x5C3E;&#x6570;&#x662F;0&#xFF0C;<strong>&#x4E0E;</strong>&#x8FD0;&#x7B97;&#x7ED3;&#x679C;&#x53EA;&#x53EF;&#x80FD;&#x662F;0&#x3002;&#x5BFC;&#x81F4;&#x6240;&#x6709;&#x4F4D;&#x7F6E;&#x7D22;&#x5F15;&#x7684;&#x8BA1;&#x7B97;&#x503C;&#x90FD;&#x53EA;&#x80FD;&#x662F;&#x5076;&#x6570;&#xFF0C;&#x6D6A;&#x8D39;&#x4E00;&#x534A;&#x7A7A;&#x95F4;&#x3002;</p>
<table>
<thead>
<tr>
<th>2&#x7684;&#x6574;&#x6570;&#x6B21;&#x5E42;</th>
<th></th>
<th>2&#x7684;&#x6574;&#x6570;&#x6B21;&#x5E42;-1</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>$$2^1 = 2$$</td>
<td>10</td>
<td>$$2^1 -1= 1$$</td>
<td>1</td>
</tr>
<tr>
<td>$$2^2 = 4$$</td>
<td>100</td>
<td>$$2^2 -1= 3$$</td>
<td>11</td>
</tr>
<tr>
<td>$$2^3 = 8$$</td>
<td>1000</td>
<td>$$2^3 -1= 7$$</td>
<td>111</td>
</tr>
<tr>
<td>$$2^4 = 16$$</td>
<td>10000</td>
<td>$$2^4 -1= 15$$</td>
<td>1111</td>
</tr>
<tr>
<td>$$2^5 = 32$$</td>
<td>100000</td>
<td>$$2^5 -1= 31$$</td>
<td>11111</td>
</tr>
<tr>
<td>...</td>
<td>...</td>
<td>...</td>
</tr>
</tbody>
</table>
<p>2&#x3001; &#x901A;&#x8FC7;<strong>&#x4E0E;</strong>&#x8FD0;&#x7B97;&#x7D22;&#x5F15;&#xFF0C;&#x4E00;&#x6B21;&#x8FD0;&#x7B97;&#x6548;&#x7387;&#x66F4;&#x9AD8;&#xFF0C;&#x800C;&#x4E14;&#x4FDD;&#x8BC1;&#x53D6;&#x6837;&#x6570;&#x636E;&#x5C0F;&#x4E8E;table&#x957F;&#x5EA6;&#xFF0C;&#x4F8B;&#x5982;&#xFF0C;&#x957F;&#x5EA6;&#x4E3A;16&#xFF08;10000&#xFF09;&#xFF0C;length - 1 = 15&#xFF08;1111&#xFF09;&#xFF1B;&#x6240;&#x6709;&#x4E0E;15&#x53C2;&#x4E0E;&#x8FD0;&#x7B97;&#x7684;Hash&#xFF0C;&#x5B9E;&#x9645;&#x8FD0;&#x7B97;&#x90FD;&#x53EA;&#x6709;&#x540E;4&#x4F4D;&#xFF0C;&#x5FC5;&#x7136;&#x4E0D;&#x4F1A;&#x4EA7;&#x751F;&#x5927;&#x4E8E;15&#x7684;&#x503C;</p>
<hr>
<h3 id="5&#x3001;&#x7075;&#x6D3B;&#x9AD8;&#x6548;&#x72B6;&#x6001;&#x5B58;&#x50A8;">5&#x3001;&#x7075;&#x6D3B;&#x9AD8;&#x6548;&#x72B6;&#x6001;&#x5B58;&#x50A8;</h3>
<p><strong>&#x6848;&#x4F8B;A</strong>&#xFF1A;&#x5728;&#x8FD0;&#x8425;&#x7CFB;&#x7EDF;&#x4E2D;&#xFF0C;&#x7528;&#x6237;&#x53EF;&#x4EE5;&#x9886;&#x53D6;&#x73B0;&#x91D1;&#x5238;<strong>20&#x3001;30&#x3001;50...</strong>&#x5143;&#xFF0C;&#x6309;&#x7167;&#x4F20;&#x7EDF;&#x5173;&#x7CFB;&#x578B;&#x6570;&#x636E;&#x5E93;&#x8BBE;&#x8BA1;&#xFF0C;&#x9700;&#x8981;&#x4E00;&#x5F20;&#x9886;&#x53D6;&#x8BB0;&#x5F55;&#x8868;&#xFF0C;&#x8BB0;&#x5F55;&#x7528;&#x6237;&#x7F16;&#x53F7;&#x53CA;&#x6BCF;&#x5F20;&#x73B0;&#x91D1;&#x5238;&#x7684;&#x9886;&#x53D6;&#x72B6;&#x6001;&#x3002;&#x524D;&#x53F0;&#x67E5;&#x8BE2;&#x7528;&#x6237;&#x662F;&#x5426;&#x5DF2;&#x7ECF;&#x9886;&#x53D6;&#x6307;&#x5B9A;&#x9762;&#x989D;&#x73B0;&#x91D1;&#x5238;&#xFF0C;&#x5219;&#x9700;&#x8981;&#x67E5;&#x8BE2;&#xFF1A;
<code>select &#x72B6;&#x6001; from Record where &#x7528;&#x6237;ID = id and &#x9762;&#x989D; = amount</code></p>
<table>
<thead>
<tr>
<th>&#x7528;&#x6237;ID</th>
<th>&#x9762;&#x989D;</th>
<th>&#x72B6;&#x6001;</th>
</tr>
</thead>
<tbody>
<tr>
<td>148</td>
<td>20</td>
<td>&#x9886;&#x53D6;</td>
</tr>
<tr>
<td>148</td>
<td>30</td>
<td>&#x9886;&#x53D6;</td>
</tr>
<tr>
<td>148</td>
<td>50</td>
<td>&#x672A;&#x9886;&#x53D6;</td>
</tr>
<tr>
<td>233</td>
<td>20</td>
<td>&#x672A;&#x9886;&#x53D6;</td>
</tr>
<tr>
<td>233</td>
<td>30</td>
<td>&#x9886;&#x53D6;</td>
</tr>
<tr>
<td>233</td>
<td>50</td>
<td>&#x9886;&#x53D6;</td>
</tr>
<tr>
<td>...</td>
<td>...</td>
<td>...</td>
</tr>
</tbody>
</table>
<p>&#x5982;&#x679C;&#x6362;&#x6210;bitmap&#x5B58;&#x50A8;&#x600E;&#x4E48;&#x73A9;&#xFF1F;&#x6839;&#x636E;&#x9700;&#x6C42;&#xFF0C;&#x7528;&#x6237;&#x53EF;&#x9886;&#x7684;&#x73B0;&#x91D1;&#x5238;&#x9762;&#x989D;&#x662F;&#x6709;&#x9650;&#x7684;&#xFF0C;&#x9996;&#x5148;&#x6309;&#x5E8F;&#xFF0C;&#x4E3A;&#x6BCF;&#x5F20;&#x9762;&#x989D;&#x7684;&#x5238;&#x5206;&#x522B;&#x6307;&#x5B9A;&#x4E00;&#x4E2A;&#x5341;&#x8FDB;&#x5236;&#x6574;&#x6570;&#x6807;&#x8BC6;&#x7801;&#xFF0C;&#x5982;&#x4E0B;&#x8868;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>&#x9762;&#x989D;</th>
<th>&#x6807;&#x8BC6;&#x7801;</th>
</tr>
</thead>
<tbody>
<tr>
<td>20</td>
<td>1&#x3010;1&#x3011;</td>
</tr>
<tr>
<td>30</td>
<td>10&#x3010;2&#x3011;</td>
</tr>
<tr>
<td>50</td>
<td>100&#x3010;4&#x3011;</td>
</tr>
<tr>
<td>..</td>
<td>1000&#x3010;8&#x3011;</td>
</tr>
<tr>
<td>..</td>
<td>10000&#x3010;16&#x3011;</td>
</tr>
<tr>
<td>..</td>
<td>100000&#x3010;32&#x3011;</td>
</tr>
</tbody>
</table>
<p>&#x6807;&#x8BC6;&#x7801;&#x8BA1;&#x7B97;&#x516C;&#x5F0F;&#x662F;&#xFF1A;</p>
<p>$$2 ^ n$$</p>
<p>&#x800C;&#x7528;&#x6237;&#x7684;&#x9886;&#x53D6;&#x72B6;&#x6001;&#x5219;&#x4E3A;&#x5DF2;&#x9886;&#x5238;&#x9762;&#x989D;&#x5BF9;&#x5E94;&#x6807;&#x8BC6;&#x7801;&#x4E4B;&#x548C;&#xFF1A;</p>
<p>$$\sum_{i=0}^n a_i= 2 ^n + ... + 2^1 + 2^0 $$</p>
<p>&#x56DE;&#x5230;&#x6848;&#x4F8B;&#xFF0C;&#x6839;&#x636E;&#x9886;&#x53D6;&#x8BB0;&#x5F55;&#x8868;&#x53EF;&#x77E5;&#xFF1A;148&#x7528;&#x6237;&#x5DF2;&#x9886;&#x53D6;20&#x3001;30&#x5143;&#xFF0C;&#x6807;&#x8BC6;&#x7801;&#x5206;&#x522B;&#x4E3A;<code>1&#x3001;2</code>&#xFF1B;233&#x7528;&#x6237;&#x5DF2;&#x9886;&#x53D6;30&#x3001;50&#x5143;&#xFF0C;&#x6807;&#x8BC6;&#x7801;&#x4E3A;&#xFF1A;<code>2&#x3001;4</code>&#x3002;</p>
<table>
<thead>
<tr>
<th>&#x7528;&#x6237;ID</th>
<th>&#x9886;&#x5238;&#x72B6;&#x6001;</th>
</tr>
</thead>
<tbody>
<tr>
<td>148</td>
<td>3 = 1 + 2</td>
</tr>
<tr>
<td>233</td>
<td>4 = 2 + 4</td>
</tr>
</tbody>
</table>
<p>&#x5F53;&#x9700;&#x8981;&#x67E5;&#x8BE2;&#x7528;&#x6237;&#x9886;&#x5238;&#x72B6;&#x6001;&#x65F6;&#xFF0C;&#x8BED;&#x53E5;&#x5219;&#x6539;&#x4E3A;&#xFF1A;<code>select 1 from Record where &#x7528;&#x6237;ID = id and &#x9886;&#x5238;&#x72B6;&#x6001; &amp; amount = amount</code>&#x3002;&#x4F8B;&#x5982;148&#x7528;&#x6237;&#xFF0C;<code>3 &amp; 2 = 2</code>&#x8868;&#x793A;&#x5DF2;&#x7ECF;&#x9886;&#x53D6;30&#x5143;&#xFF0C;&#x800C;<code>3 &amp; 5 = 0</code>&#x5219;&#x8868;&#x793A;&#x7528;&#x6237;&#x8FD8;&#x6CA1;&#x9886;&#x53D6;50&#x5143;&#x3002;</p>
<table>
<thead>
<tr>
<th>&#x8F6C;&#x7801;</th>
<th>&#x6807;&#x8BC6;&#x7801;</th>
<th>&#x4F4E;&#x4F4D;&#x4E0B;&#x6807;</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>&#x3010;1&#x3011;</td>
<td>0</td>
</tr>
<tr>
<td>10</td>
<td>&#x3010;2&#x3011;</td>
<td>1</td>
</tr>
<tr>
<td>100</td>
<td>&#x3010;4&#x3011;</td>
<td>2</td>
</tr>
<tr>
<td>1000</td>
<td>&#x3010;8&#x3011;</td>
<td>3</td>
</tr>
<tr>
<td>10000</td>
<td>&#x3010;16&#x3011;</td>
<td>4</td>
</tr>
<tr>
<td>100000</td>
<td>&#x3010;32&#x3011;</td>
<td>5</td>
</tr>
</tbody>
</table>
<p>&#x6839;&#x636E;&#x9762;&#x989D;&#x4E0E;&#x6807;&#x8BC6;&#x7801;&#x7684;&#x6620;&#x5C04;&#x8868;&#xFF0C;&#x6807;&#x8BC6;&#x7801;&#x8F6C;&#x6362;&#x4E3A;&#x4E8C;&#x8FDB;&#x5236;&#x540E;&#xFF0C;&#x6240;&#x6709;&#x8F6C;&#x7801;&#x7684;&#x6700;&#x9AD8;&#x4F4D;&#x90FD;&#x662F;1&#xFF0C;&#x5176;&#x4ED6;&#x4F4D;&#x6570;&#x5747;&#x4E3A;0&#xFF0C;&#x4E14;&#x5404;&#x4E0D;&#x76F8;&#x7B49;&#xFF0C;&#x56E0;&#x6B64;&#x8F6C;&#x7801;&#x4E4B;&#x548C;&#x4E00;&#x5B9A;&#x4E0D;&#x4F1A;&#x53D1;&#x751F;&#x8FDB;&#x4F4D;&#x3002;&#x4F8B;&#x5982;&#xFF1A;&#x6807;&#x8BC6;&#x7801;&#x662F;<code>21 = 1 + 4 + 16</code>&#xFF0C;&#x8F6C;&#x7801;&#x7ED3;&#x679C;&#x5C31;&#x662F;<code>10101 = 10000 + 100 + 1</code> &#x3002;</p>
<p>&#x7531;&#x4E8E;0&#x4E0E;&#x65E0;&#x8BBA;&#x662F;0&#x6216;1&#x8FDB;&#x884C;<code>&amp;</code>&#x8FD0;&#x7B97;&#xFF0C;&#x7ED3;&#x679C;&#x90FD;&#x662F;0&#xFF1B;&#x56E0;&#x6B64;&#x53EA;&#x8981;<code>&#x603B;&#x548C; &amp; &#x6807;&#x8BC6;&#x7801; =  &#x6807;&#x8BC6;&#x7801;</code>&#xFF0C;&#x8868;&#x793A;&#x603B;&#x548C;&#x5305;&#x542B;&#x5BF9;&#x5E94;&#x6807;&#x8BC6;&#x7801;&#x3002;&#x5341;&#x8FDB;&#x5236;&#x516C;&#x5F0F;&#x4E3A;&#xFF1A;</p>
<p>$$ (2^a + 2^b) \&amp; 2^a = 2^a [a!=b]$$</p>
<pre><code>10101 &amp;
10000 =
10000 //21&#x5305;&#x542B;16

10101 &amp;
01000 =
00000 //21&#x4E0D;&#x5305;&#x542B;8
</code></pre><hr>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; tgor.top 2019 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2020-04-23 15:32:53
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../Java-Spring/SpringBoot事务注解@Transactional.html" class="navigation navigation-prev " aria-label="Previous page: Spring事务注解@Transactional">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../Mongodb-Client/morphia-API汇总.html" class="navigation navigation-next " aria-label="Next page: morphia API汇总">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"位运算应用实例","level":"1.3.9","depth":2,"next":{"title":"morphia API汇总","level":"1.3.10","depth":2,"path":"Mongodb-Client/morphia-API汇总.md","ref":"Mongodb-Client/morphia-API汇总.md","articles":[]},"previous":{"title":"Spring事务注解@Transactional","level":"1.3.8","depth":2,"path":"Java-Spring/SpringBoot事务注解@Transactional.md","ref":"Java-Spring/SpringBoot事务注解@Transactional.md","articles":[]},"dir":"ltr"},"config":{"plugins":["chapter-fold","splitter","tbfed-pagefooter","page-toc-button","-search","search-pro","popup","back-to-top-button","code","copy-code-button"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy tgor.top 2019","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"splitter":{},"search-pro":{"cutWordLib":"nodejieba","defineWord":["Gitbook Use"]},"popup":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"code":{"copyButtons":true},"fontsettings":{"theme":"sepia","family":"serif","size":1},"highlight":{},"page-toc-button":{"maxTocDepth":2,"minTocSize":2},"back-to-top-button":{},"copy-code-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"tgor","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"tgor note","gitbook":"*","description":"tgor生活工作记录"},"file":{"path":"数据结构与算法/位运算应用实例.md","mtime":"2020-04-23T07:32:53.392Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-04-29T08:43:24.127Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

